package com.ling.pl.autoproject.definition.entity.model;

import com.ling.pl.core.commons.annotation.Dict;
import com.ling.pl.core.commons.annotation.ModelProperty;

import javax.persistence.Column;

/**
 * 1:n关系
 */
public class EntityRelation {
    ///todo 继承关系,索引关系,1:1关系,多继承关系
    //实体关系 1:n信息
    @Column(name = "NAME", length = 36)
    @ModelProperty(comment = "中文名称")
    String name;

    @Column(name = "CODE", length = 36)
    @ModelProperty(comment = "关系编码")
    String code;

    @Column(name = "REMARK", length = 500)
    @ModelProperty(comment = "备注")
    String remark;

    @Column(name = "RELATION_TYPE", length = 150)
    @ModelProperty(comment = "关系类型")
    @Dict(code = "builder.entity.relationType", des = "1:n,继承,索引,1:1,多继承(虚拟实体)")
    String relationType;

    @Column(name = "MASER_ENTITY_ID", length = 36)
    @ModelProperty(comment = "关系主实体")
    String masterEntityId;

    @Column(name = "SLAVE_ENTITY_ID", length = 36)
    @ModelProperty(comment = "关系从实体")
    String slaveEntityId;

    @Column(name = "MASTER_ENTITY_PROPERTY", length = 150)
    @ModelProperty(comment = "主实体字段")
    String masterEntityProperty;

    @Column(name = "SLAVE_ENTITY_PROPERTY", length = 150)
    @ModelProperty(comment = "从实体字段")
    String slaveEntityProperty;

    @Column(name = "MASTER_SLAVE_TYPE", length = 150)
    @ModelProperty(comment = "主从关系类型")
    @Dict(code = "builder.entity.masterSlaveType", des = "附属关系,附属关系(nn链接),数据访问控制")
    String masterSlaveType;

    @Column(name = "MASTER_REMOVE_OP_TYPE", length = 150)
    @ModelProperty(comment = "主实体删除操作")
    @Dict(code = "builder.entity.masterRemoveOperationType", des = "无操作,同时删除,置空,限制删除")
    String masterRemoveOperationType;

    @Column(name = "MASTER_REMOVE_ORDER_TYPE", length = 150)
    @ModelProperty(comment = "删除次序")
    @Dict(code = "builder.entity.masterRemoveOrderType", des = "无操作,同时删除,置空,限制删除")
    String masterRemoveOrderType;

    @Column(name = "MASTER_REMOVE_REJECT_MSG_I18N", length = 150)
    @ModelProperty(comment = "删除拒绝语言资源")
    String masterRemoveRejectMsgI18n;

    @Column(name = "MASTER_REMOVE_REJECT_MSG", length = 150)
    @ModelProperty(comment = "删除拒绝消息")
    String masterRemoveRejectMsg;

    @Column(name = "REL_DATA_SET_ID", length = 36)
    @ModelProperty(comment = "关系数据集合")
    String relDataSetId;

    @Column(name = "ENTITY_FILL_ID", length = 36)
    @ModelProperty(comment = "实体自填模式")
    String entityFillId;

    @Column(name = "SINGLE_SELECT_VIEW_ID", length = 36)
    @ModelProperty(comment = "单项数据选择视图")
    String singleSelectViewId;

    @Column(name = "MULTI_SELECT_VIEW_ID", length = 36)
    @ModelProperty(comment = "多项数据选择视图")
    String multiSelectViewId;

    @Column(name = "REL_DATA_SELECT_VIEW_ID", length = 36)
    @ModelProperty(comment = "关系数据展现视图")
    String relDataSelectViewId;

    //附加约束
    @Column(name = "IS_ADDITION_CONSTRAINTS")
    @ModelProperty(comment = "启用附加属性")
    Boolean isAdditionConstraints;

    @Column(name = "MASTER_ADDITION_PROPERTY", length = 150)
    @ModelProperty(comment = "附加约束主实体属性")
    String masterAdditionProperty;

    @Column(name = "SLAVE_ADDITION_PROPERTY", length = 150)
    @ModelProperty(comment = "附加约束从实体属性")
    String slaveAdditionProperty;

    //父关系等价
    @Column(name = "IS_PARENT_RELATION")
    @ModelProperty(comment = "父关系等价")
    Boolean isParentRelation;

    @Column(name = "MASTER_PARENT_RELATION_ID", length = 36)
    @ModelProperty(comment = "主实体父关系", des = "主实体中的关系id")
    String masterParentRelationId;

    @Column(name = "SLAVE_PARENT_RELATION_ID", length = 36)
    @ModelProperty(comment = "附属实体父关系", des = "附属实体中的关系id")
    String slaveParentRelationId;
}
